package com.lagou.sqlsession;

import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.List;

/**
 * @ClassName: SqlSession
 * @Description: sql会话，定义数据库的CRUD
 * @Author: qiaojiacheng
 * @Date: 2021/7/22 2:32 下午
 */
public interface SqlSession {

    /**
     * 查询所有
     */
    public <E> List<E> selectList(String statementId, Object... params) throws IllegalAccessException, IntrospectionException, InstantiationException, SQLException, InvocationTargetException, NoSuchFieldException;

    /**
     * 查询一个
     */
    public <T> T selectOne(String statementId, Object... params) throws IllegalAccessException, IntrospectionException, InstantiationException, SQLException, InvocationTargetException, NoSuchFieldException;

    /**
     * 增加
     */
    public int add(String statementId, Object... params) throws IllegalAccessException, IntrospectionException, InstantiationException, SQLException, InvocationTargetException, NoSuchFieldException;

    /**
     * 删除
     */
    public int delete(String statementId, Object... params) throws IllegalAccessException, IntrospectionException, InstantiationException, SQLException, InvocationTargetException, NoSuchFieldException;

    /**
     * 修改
     */
    public int update(String statementId, Object... params) throws IllegalAccessException, IntrospectionException, InstantiationException, SQLException, InvocationTargetException, NoSuchFieldException;

    /**
     * 使用代理模式来创建接口的代理对象
     */
    public <T> T getMapper(Class<?> mapperClass);

}
